package com.vf.admin.client.service.impl;

import com.vf.admin.client.dao.AppFamilyDao;
import com.vf.admin.client.dao.AppFamilyPrestigeDao;
import com.vf.admin.client.service.AppFamilyPrestigeService;
import com.vf.admin.client.service.AppFamilyService;
import com.vf.admin.miaodong.entity.AppFamilyPrestige;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class AppFamilyPrestigeServiceImpl implements AppFamilyPrestigeService {

    @Autowired
    private AppFamilyPrestigeDao appFamilyPrestigeDao;
    @Autowired
    private AppFamilyDao appFamilyDao;
    @Autowired
    private AppFamilyService appFamilyService;


    @Override
    public void addPrestisge(Integer type, Integer num, Integer userId, String descMsg, Integer fid) {
        AppFamilyPrestige appFamilyPrestige = new AppFamilyPrestige();
        appFamilyPrestige.setUserid(userId);
        appFamilyPrestige.setPrestigenum(num);
        appFamilyPrestige.setType(type);
        appFamilyPrestige.setDescmsg(descMsg);
        appFamilyPrestige.setCreatetime(new Date());
        appFamilyPrestige.setFid(fid);
        appFamilyPrestigeDao.add(appFamilyPrestige);
//        appFamilyDao.prestigeNumInc(fid,num);
        appFamilyService.prestigeNumInc(fid,num);
    }

    @Override
    public AppFamilyPrestige getDayPrestige(Integer UserId) {
        return appFamilyPrestigeDao.getDayPrestigenum(UserId);
    }
}
